package com.ebt.m.utils;

import com.ebt.m.data.db.Product;
import com.ebt.m.data.entity.NewProductInfo;
import com.ebt.m.data.entity.ProductInfo;

/**
 * Created by andy.wang on 2016/12/15.
 */

public class ProductInfoWrapper {

    /**
     * 新的产品类转换成旧的产品类
     * @param newProductInfo
     * @return
     */
    public static ProductInfo productInfoWrap(NewProductInfo newProductInfo) {
        ProductInfo productInfo = new ProductInfo();
        productInfo.Id = newProductInfo.getProductId();
        productInfo.Name = newProductInfo.getName();
        productInfo.ShortName = newProductInfo.getShortName();
        productInfo.Description = newProductInfo.getDescription();
        productInfo.Thumbnail = newProductInfo.getThumbnail();
        productInfo.ContractProperty = newProductInfo.isMain() ? 1 : 0;
        productInfo.companyName = newProductInfo.getCompanyName();
        productInfo.companyShortName = newProductInfo.getCompanyShortName();
        return productInfo;
    }
}
